package com.hd.trans.framework.languages;

import android.view.View;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.entity.node.BaseNode;
import com.chad.library.adapter.base.provider.BaseNodeProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hd.trans.R;
import com.hd.trans.db.bean.LanguageGroup;
import com.hd.trans.common.Constants;

import org.greenrobot.greendao.annotation.NotNull;

/**
 * Author:  yang
 * Date:    2020/01/07 18:11
 * Desc:    类作用描述
 */
public class LanguageGroupProvider extends BaseNodeProvider {

    @Override
    public int getItemViewType() {
        return Constants.LevelType.GROUP;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_language_group;
    }

    @Override
    public void convert(@NotNull BaseViewHolder helper, @Nullable BaseNode data) {
        // 数据类型需要自己强转
        final LanguageGroup group = (LanguageGroup) data;
        if (group != null) {
            helper.setText(R.id.tv_name, group.getName());
        }
    }

    @Override
    public void onClick(@NotNull BaseViewHolder helper, @NotNull View view, BaseNode data, int position) {
//        getAdapter().expandOrCollapse(position);
    }

}